package com.mcp.converter.domain.checker;

import lombok.Data;

import java.util.List;
import java.util.Map;

/**
 * 兼容性检测结果类
 */
@Data
public class CompatibilityResult {
    
    /**
     * 是否完全兼容
     */
    private boolean compatible;
    
    /**
     * 不兼容点列表
     */
    private List<IncompatiblePoint> incompatiblePoints;
    
    /**
     * 附加属性
     */
    private Map<String, Object> attributes;
    
    public CompatibilityResult() {
        this.incompatiblePoints = new java.util.ArrayList<>();
        this.attributes = new java.util.HashMap<>();
    }
    
    public CompatibilityResult(boolean compatible) {
        this();
        this.compatible = compatible;
    }
    
    /**
     * 添加不兼容点
     * @param incompatiblePoint 不兼容点
     */
    public void addIncompatiblePoint(IncompatiblePoint incompatiblePoint) {
        if (incompatiblePoint != null) {
            this.incompatiblePoints.add(incompatiblePoint);
            this.compatible = false;
        }
    }
    
    /**
     * 获取不兼容点数量
     * @return 不兼容点数量
     */
    public int getIncompatiblePointCount() {
        return this.incompatiblePoints.size();
    }
    
    /**
     * 是否存在不兼容点
     * @return 是否存在不兼容点
     */
    public boolean hasIncompatiblePoints() {
        return !this.incompatiblePoints.isEmpty();
    }
    
    /**
     * 添加属性
     * @param key 属性键
     * @param value 属性值
     */
    public void addAttribute(String key, Object value) {
        this.attributes.put(key, value);
    }
    
    /**
     * 获取属性
     * @param key 属性键
     * @return 属性值
     */
    public Object getAttribute(String key) {
        return this.attributes.get(key);
    }
}
